package com.security.demo.aspect;

import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @title TimeAspect
 * @version 1.0.0
 * @description 
 * @author liukang
 * @date 2019年4月25日
 */
//@Aspect
//@Component
public class TimeAspect {

	@Around("execution(* com.security.demo.controller.UserController.*(..))")
	public Object handleControllerMethod(ProceedingJoinPoint pjp) throws Throwable {
		System.out.println("time aspect start");
		long start = new Date().getTime();
		Object object = pjp.proceed();
		Object[] args = pjp.getArgs();
		for (Object arg : args) {
			System.out.println("arg : "+ arg);
		}
		
		
		System.out.println("time aspect 耗时:" + (new Date().getTime() - start));
		System.out.println("time aspect end");
		return object;
	}
}
